#ifndef __COMMON__
#include <iostream>

// 日志等级划分
#define INF 0
#define DBG 1
#define ERR 2
// 低于LOG_LEVEL等级的日志信息不打印
#define LOG_LEVEL INF
// 日志打印宏
#define LOG(level, format, ...) do{\
        if(level < LOG_LEVEL) break;\
        time_t t = time(nullptr);\
        struct tm *ltm = localtime(&t);\
        char tmp[32] = {0};\
        strftime(tmp, 32, "%Y-%m-%d %H:%M:%S", ltm);\
        fprintf(stdout, "[%p %s|%s:%d] " format "\n", (void*)pthread_self(), tmp, __FILE__, __LINE__, ##__VA_ARGS__);\
    }while(0)
#define INF_LOG(format, ...) LOG(INF, format, ##__VA_ARGS__)
#define DBG_LOG(format, ...) LOG(DBG, format, ##__VA_ARGS__)
#define ERR_LOG(format, ...) LOG(ERR, format, ##__VA_ARGS__)

#endif

#define __COMMON__